package com.ayf.payment.game.api.controller.platform;


import com.ayf.payment.game.api.dto.MerchantPayOrderDTO;
import com.ayf.payment.game.api.dto.PageInfoDTO;
import com.ayf.payment.game.api.dto.criteria.MerchantPayOrderCriteria;
import com.ayf.payment.game.api.exception.ParameterException;
import com.ayf.payment.game.api.service.MerchantPayOrderService;
import com.ayf.payment.game.api.type.CommonConstants;
import com.ayf.payment.game.api.utils.CommonResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RequestMapping("/t/merchant/pay/order")
@RestController
public class AdminMerchantPayOrderController {


    @Autowired
    MerchantPayOrderService merchantPayOrderService;

    /**
     * 商户代付订单记录查询
     * @param merchantPayOrderCriteria
     * @return
     */
    @PostMapping("/list")
    public CommonResult<PageInfoDTO> list(@RequestBody MerchantPayOrderCriteria merchantPayOrderCriteria) {
        if (merchantPayOrderCriteria == null) {
            throw new ParameterException("查询失败，参数不能为空");
        }
        PageInfoDTO<MerchantPayOrderDTO> pageDTO = merchantPayOrderService.getMerchantPayOrderListByPage(merchantPayOrderCriteria);
        return new CommonResult<>(CommonConstants.RETURN_SUCCESS, "查询成功",pageDTO);
    }

}
